
"""
Created on Tue Feb 19 14:55:43 2013

@author: aponteeduarddo@gmail.com
Copyright Eduardo Aponte 2013.
"""

from mex_binder import binder_py

mx_set_offline_mode = binder_py('mx_set_offline_mode')
mx_set_offline_mode.mx_c.headers = ['<eyelink.h>','"mex.h"']
mx_set_offline_mode.bindo += []
mx_set_offline_mode.mx_c.code = \
"""
INT16 _main( void )
{
    return set_offline_mode(  ); ;
}

void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
    mwSize td[2] = {1,1};
    double *status;
    
    /* Verify input arguments. */
    if(nrhs != 0 ) {
        mexErrMsgTxt("Incorrect number of inputs.");
    } else if( nlhs > 1 ) {
        mexErrMsgTxt("Too many output arguments.");
    }
            
    plhs[0] = mxCreateNumericArray( 2, td, mxDOUBLE_CLASS, mxREAL);
    status = mxGetPr(plhs[0]);    
    *status = (double ) _main( ); 
    return;
}
"""

mx_set_offline_mode.mx_c.mdoc = \
"""function [ ] = mx_set_offline_mode( )
%MX_SET_OFFLINE_MODE Places EyeLink tracker in off-line (idle) mode. Wait till
% the tracker has finished the mode transition.
%
% Returns:
% 0 if mode switched, else link error.
%
"""
mx_set_offline_mode.write_c()
mx_set_offline_mode.write_m()
mx_set_offline_mode.compile()
mx_set_offline_mode.write_sh()

